Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 224 action hangs in some cases for go fiber benchmarks #225

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

ktrz
Copy link
Member

@ktrz ktrz commented Feb 1, 2024

  • fix reExtract regexp to avoid catastrophic backtracking
  • add test cases from fiber that were causing issues

fixes #224

* fix reExtract regexp to avoid catastrophic backtracking
* add test cases from fiber that were causing issues
@ktrz ktrz requested a review from ningziwen February 1, 2024 14:25
@ktrz ktrz self-assigned this Feb 1, 2024
@ktrz ktrz mentioned this pull request Feb 1, 2024
…le metrics in Go but they were not extracted properly before v1.18.0
@@ -353,7 +353,7 @@ function extractGoResult(output: string): BenchmarkResult[] {
// "A benchmark result line has the general form: <name> <iterations> <value> <unit> [<value> <unit>...]"
// "The fields are separated by runs of space characters (as defined by unicode.IsSpace), so the line can be parsed with strings.Fields. The line must have an even number of fields, and at least four."
const reExtract =
/^(?<name>Benchmark\w+(?:\/?[\w()$%^&*-=,]*?)*?)(?<procs>-\d+)?\s+(?<times>\d+)\s+(?<remainder>.+)$/;
/^(?<name>Benchmark\w+[\w()$%^&*-=|,[\]{}"#]*?)(?<procs>-\d+)?\s+(?<times>\d+)\s+(?<remainder>.+)$/;
Copy link
Member Author

@ktrz ktrz Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds some additional characters that were present in Go Fiber benchmarks as well as removes the nested (()*?)*? which was causing the regex to hang in some instances

@@ -209,6 +209,12 @@ describe('extractResult()', function () {
value: 40537.456,
extra: '30001 times',
},
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the backward compatible metric as before v1.18.0 it was resulting like that in case of multiple metrics

@ktrz ktrz merged commit 1c81dfd into master Feb 2, 2024
21 checks passed
@ktrz ktrz deleted the fix/224-action-hangs-on-gofiber-benchmarks branch February 2, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Benchmark job never finishes
2 participants